<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=\, initial-scale=1.0">
    <title>Document</title>
    <style>
        a {
            text-decoration: none;
        }

        span {
            color: red;
        }
    </style>
</head>

<body>
    <a href="https://www.baidu.com">倒计时<span>5</span>秒跳转到百度</a>
    <script>
        let a = document.querySelector('a')
        let n = 5
        let timer = setInterval(function () {
            n--
            a.innerHTML = `
                倒计时<span>${n}</span>秒跳转到百度
            `
            if (n <= 0) {
                clearInterval(timer)
                location.href = 'https://www.baidu.com'
            }
        }, 1000)
    </script>
</body>

</html>